/**
 * 
 */
package mdb.com.vn.web.view;

import java.io.Serializable;
import java.util.List;

import javax.faces.model.ListDataModel;

import org.primefaces.model.SelectableDataModel;

import mdb.com.vn.model.IBanking;

/**
 * @author tu.dod
 *
 */
public class IBDataModel extends ListDataModel<IBanking> implements SelectableDataModel<IBanking>,Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	public IBDataModel(List<IBanking> iBankings){
		super(iBankings);
	}
	public IBDataModel(){
		
	}
	@Override
	public IBanking getRowData(String rowKey) {
		@SuppressWarnings("unchecked")
		List<IBanking> iBankings = (List<IBanking>) getWrappedData();
		for (IBanking iBanking : iBankings) {
			if(String.valueOf(iBanking.getId()).equals(rowKey)){
				return iBanking;
			}
		}
		return null;
	}

	@Override
	public Object getRowKey(IBanking iBanking) {
		// TODO Auto-generated method stub
		return iBanking.getId();
	}

}
